<?php

namespace app\posapi\validate;

use think\Validate;

class SellPosPAY_Pay extends Validate
{
    protected $rule = [

        'dbid' => 'require|string', //POS销售单号
        "sign" => "require|string",
        "payway" => "require|string|in:9,8",//支付方式_9现金8聚合支付
        "total_amount" => "require|string|integer",//交易金额-以分为单位
        "dynamic_id" => "string",//支付码（支付宝或微信条码号-线上支付时必填）
        "operator" => "require|string",//门店操作员
        "remark" => "string",//备注
        "pay_currency" => "string|in:A1,RMB,HKD,USD",//支付币种-云支付时无效

        // 'client_sn' => 'length:2,99', //
        // "table_detail" =>  "require|array|length:1,999", //
        // 'user_type' => 'require|in:user,agent,admin',
    ];
    protected $message = [
        'dbid' => 'POS销售单号-dbid',
        "sign" => "改单签名串-sign",
        "payway" => "支付方式-payway",//支付方式_9现金8聚合支付
        "total_amount" => "交易金额-total_amount",//交易金额-以分为单位
        "dynamic_id" => "支付码-dynamic_id",//支付码（支付宝或微信条码号-线上支付时必填）
        "operator" => "门店操作员-operator",//门店操作员
        "remark" => "支付备注-remark",//备注
        "pay_currency" => "支付币种-pay_currency",//支付币种-云支付时无效
        // 'user_type.require' => '帐号类型必须', //帐号类型admin总部agent代理user一般用户
        // 'user_type.in' => '帐号类型仅限:user,agent,admin', //帐号类型admin总部agent代理user一般用户
    ];

    // 自定义验证方法-帐号类型
    protected function userType($value, $rule, $requestdb)
    {
        // dump($value);
        // dump($rule);
        // dump($requestdb);
    }
}
